< previous page page_495 next page >

Page 495
z0515-01.gif
Figure 14.19
A fractal surface produced by subdividing
the surface in Figure 14.17 three times.
of two. This allows random changes to be relatively large during the highest-level calls to Subdivide. As the regions are broken into smaller and smaller pieces, the amount of random change allowed is smaller. Changes during the higher-level calls set the general shape of the surface. Changes during the lower-level calls refine it.
e10a6a0a59f035e870d90cca05b85fce.gif
' Generate the fractal surface.
Public Sub GenerateSurface(ByVal divisions As Integer, _
    ByVal Dy As Single)
Dim oldpoints() As Point3D
Dim oldx As Integer
Dim oldz As Integer
Dim factor As Integer
Dim newx As Integer
Dim newz As Integer
Dim i As Integer
Dim j As Integer
Dim newi As Integer
Dim newj As Integer

    ' Make room for the new data.
    factor = 2 ^ divisions
    newx = (NumX - 1) * factor + 1
    newz = (NumZ - 1) * factor + 1

    ' Copy the original data.
    ReDim oldpoints(1 To NumX, 1 To NumZ)
    For i = 1 To NumX
        For j = 1 To NumZ

 
< previous page page_495 next page >